package com.zjitc.chapter12.controller;

import com.zjitc.chapter12.domain.Product;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@Controller
public class ProductController {
    @RequestMapping("/getProducts")
    public void getProducts(@RequestParam("ids") List<String> prodIds) {
        System.out.println("ProductController.getProducts");
        System.out.println("ids = " + prodIds);
    }
    @RequestMapping(value = "/getProduct",method = RequestMethod.POST,consumes = "application/json;charset=utf-8",produces = "application/json;charset=utf-8")
    public void getProduct(@RequestBody Product prodcut) {
        System.out.println("ProductController.getProduct");
        System.out.println("product = " + prodcut);
    }
    @RequestMapping("/getProductList")
    public void getProductList(@RequestBody List<Product> products) {
        System.out.println("ProductController.getProducts");
        System.out.println("ids = " + products);
    }
}
